package com.legna.mhxy.support.controller;

import com.legna.mhxy.support.entity.RingType;
import com.legna.mhxy.support.service.RingTypeService;
import com.legna.mhxy.support.utils.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag(name="环")
@RestController
@RequestMapping("/ring/type")
@AllArgsConstructor
public class RingTypeController {

    private final RingTypeService ringTypeService;

    @GetMapping
    @Operation(summary = "环查询")
    public Result<List<RingType>> listAll(@RequestParam(value = "categoryId",required = false) Long categoryId,
                                          @RequestParam(value = "categoryType",required = false) Integer categoryType,
                                          @RequestParam(value = "grade",required = false) Integer grade) {
        List<RingType> ringCategories = ringTypeService.listAll(categoryId,categoryType,grade);
        return Result.ok(ringCategories);
    }
}
